# 字典
# 无序、不可重复、双列、混装、可修改
# 字典的key和value可以是任意类型（key不能为字典）
dict0 = {"name":"syo", "age": 18}
dict1 = dict()
dict2 = {}

# 获取key所对应的值
print(dict0["name"])

# 添加key和value
dict0.setdefault("score", 199.9)
dict0["hello"] = "world"
print(dict0)

# 更新
dict0["score"] = 200

# 删除
del dict0["score"]
dict0.pop("score")

# 清空元素
dict0.clear()

# 获取全部key
print(dict0.keys())

# 遍历
for key in dict0.keys():
    print(dict0[key])

for key in dict0:
    print(key)

#  元素数量
len(dict0)

